import Vue from 'vue'
import Router from 'vue-router'
// import hello from '@/components/page1'
// import aaa from '@/components/Page2'

Vue.use(Router)

const routes=[
    {
    path: '/aaa',
    name: 'aaa',
    component: ()=>import('@/components/Page2/aaa')
},
    // {
    //     path: '/hello',
    //     name: 'hello',
    //     component: ()=>import('@/components/page1/hello')
    // },
    {
        path: '/test2',
        name: 'test2',
        component: ()=>import("@/components/pageManage/test2"),
    },
    // 测试右侧界面的可用性
    {
        path: '/right1',
        component: resolve => require(['@/components/Page2/rightTest'],resolve)
    },
    {
        path: '/header1',
        component: resolve => require(['@/components/pageManage/headPage/header'],resolve)
    },
    {
        path: '/',
        name: 'login',
        // component: ()=>import('@/components/LoginPage/login')

        component: resolve => require(['@/components/LoginPage/login'], resolve),
    },
    {
        path: '/layout',
        name: 'layout',
        // component: ()=>import("@/components/pageManage/layout"),
        component: resolve => require(['@/components/pageManage/layout'], resolve),
        children: [{

            // 点击左侧导航栏右侧界面刷新嵌套路由 方法一：请求路径path写成嵌套  https://blog.csdn.net/github_26672553/article/details/54861174
            // path: '/layout/hello',
            // component: ()=>import('@/components/page1/hello'),

            // 方法二：我也没看懂，但是有效果。 https://blog.csdn.net/bujiongdan/article/details/81503275
            path: '/hello',
            component: resolve => require(['@/components/page1/hello'], resolve),

            },
            {
                // path: '/layout/login',
                // component: () => import("@/components/LoginPage/login")
                path: '/login',
                component: resolve => require(['@/components/LoginPage/login'], resolve),
            },
            {
                path: '/right',
                component: resolve => require(['@/components/Page2/rightTest'],resolve)
            },
            ]
    },
    {
       path: '/home',
        name: 'home',
        component: ()=>import("@/components/home")
    }

]

const router =new Router({
    routes
})

export default router


// export default new Router({
//     router: [{
//         path: '/hello',
//         name: 'hello',
//         component: hello
//     },
//         {
//         path: '/aaa',
//         name: 'aaa',
//         component: aaa
//     }]
// })